package com.pengliu.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import com.pengliu.util.Constants;

@WebListener
public class ContextInitListener implements ServletContextListener{
	
	@Override
	public void contextInitialized(ServletContextEvent event) {
		System.out.println("------------servlet初始化------------");
		//初始化记录系统运行开始时间
		event.getServletContext().setAttribute(Constants.SYSRUNTIME, System.currentTimeMillis());
	}

	@Override
	public void contextDestroyed(ServletContextEvent event) {
		System.out.println("------------servlet摧毁------------");
	}
}
